#pragma once
#include <string>
#include <vector>
#include <map>
#include <mutex>

struct HostInfo {
    std::string hostname;
    std::string ip;
    int port;
    std::vector<int> activeChannels;
};

class MemLinkRegistry {
public:
    bool registerHost(const HostInfo& host);
    std::vector<HostInfo> discoverHosts();
    int assignChannel(const std::string& hostname);
    bool releaseChannel(const std::string& hostname, int channelId);
    HostInfo getHost(const std::string& hostname);

private:
    std::map<std::string, HostInfo> hostTable_;
    std::mutex registryMutex_;
    int nextChannelId_ = 0;
};
